

import bpy
import numpy as np

import 全局控制.Node.节点和插座基类.bl_节点基类 as 基类
import Core.bl_UI配色 as UI配色

import engine.initLIB.load_dll as engineLib
import ctypes


engineLib.flexCAPI.f_创建包围盒计算节点.restype = ctypes.c_bool






class C_Node_计算坐标集包围盒(基类.C_Node_基类):
	bl_dname = 'bl_node_计算坐标集包围盒'
	bl_label = '计算坐标集包围盒'
	
	def init(self, context):
		super(C_Node_计算坐标集包围盒, self).f_init(context)
		self.inputs.new('C_Socket_Vec3_Array1D', name='坐标集')
		self.outputs.new('C_Socket_矩阵3X3', name='包围盒')
		self.outputs.new('C_Socket_Vec3', name='最小边界')
		self.outputs.new('C_Socket_Vec3', name='最大边界')
		self.outputs.new('C_Socket_Vec3', name='尺寸')
		self.outputs.new('C_Socket_Vec3', name='中心')
		self.f_toCPP()
		
		self.use_custom_color = True
		self.color = UI配色.g_内部节点颜色
		

	def f_toCPP(self):
		是否更新 = engineLib.flexCAPI.f_创建包围盒计算节点(ctypes.c_wchar_p(self.id_data.name), ctypes.c_wchar_p(self.name), self.f_getPyObject());
		

class C_MENU_Add_计算坐标集包围盒(bpy.types.Operator):
	bl_idname = 'node.calculation_coordinate_boundingbox'
	bl_label = '计算坐标集包围盒'
	#bl_options = {'REGISTER', 'UNDO'}
	def execute(operator, context):
		bpy.ops.node.add_node(type='C_Node_计算坐标集包围盒', use_transform=True)
		return {'FINISHED'}


















classes = (
	C_Node_计算坐标集包围盒,
	C_MENU_Add_计算坐标集包围盒,
)

def register():
	for c in classes:
		bpy.utils.register_class(c)
		
def unregister():
	for c in classes:
		bpy.utils.unregister_class(c)









